;;; init-editor.el -- init editor
;;; Commentary:
;;; Code:

;; custom
(setq custom-file "~/.emacs.d/custom.el")
 (load custom-file)

;; auto revert
(add-hook 'after-init-hook 'global-auto-revert-mode)
(setq global-auto-revert-non-file-buffers t)
(setq auto-revert-verbose nil)

;; recentf
(add-hook 'after-init-hook 'recentf-mode)
(setq-default recentf-max-saved-items 1000)
(setq-default recentf-exclude '("/tmp/" "/ssh:"))

;; matching parens
(add-hook 'after-init-hook 'show-paren-mode)

;; bakup file
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))

;; menu bar
(if (display-graphic-p)
    (progn
      (tool-bar-mode -1)
      (menu-bar-mode -1)
      (scroll-bar-mode -1)))

;; splash screen
(setq inhibit-splash-screen t)
(setq inhibit-startup-message t)

;; case
(setq case-replace nil)

;; y/n to yes/no
(fset 'yes-or-no-p 'y-or-n-p)

;; auto pair
(add-hook 'after-init-hook 'electric-indent-mode)
(add-hook 'after-init-hook 'electric-pair-mode)

;; theme
(use-package zenburn-theme
  :config
  (load-theme 'zenburn t))

;; unicode
(use-package list-unicode-display)

;; beacon
(use-package beacon
  :config
  (setq-default beacon-lighter "")
  (setq-default beacon-size 10)
  (add-hook 'after-init-hook 'beacon-mode)
  )

;; highlight
(use-package highlight-escape-sequences
  :config
  (add-hook 'after-init-hook 'hes-mode))

;; undo-tree
(use-package undo-tree
  :config (global-undo-tree-mode 1)
  (setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo"))))

;; ace
(use-package ace-jump-mode
  :bind ("C-c SPC" . ace-jump-mode))

;; isearch
(global-set-key (kbd "M-s") 'isearch-forward-symbol-at-point)
(use-package anzu
  :config
  (use-package regex-tool)
  (add-hook 'after-init-hook 'global-anzu-mode)
  (setq anzu-mode-lighter "")
  (global-set-key [remap query-replace] 'anzu-query-replace-regexp)
  (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp))

;; helm
(use-package helm
  :bind (("M-x" . helm-M-x)
	 ("M-y" . helm-show-kill-ring)
	 ("C-x C-f" . helm-find-files)
     ("C-x C-r" . helm-recentf)
	 ("C-x C-b" . helm-buffers-list))
  :config
  (helm-mode 1)
  (setq helm-scroll-amount 4)
  (setq helm-quick-update t)
  (setq helm-idle-delay 0.01)
  (setq helm-input-idle-delay 0.01)
  (setq helm-split-window-default-side 'other)
  (setq helm-split-window-in-side-p t)
  (setq helm-candidate-number-limit 200)
  (setq helm-move-to-line-cycle-in-source nil)
  (setq helm-M-x-requires-pattern 0))

;; which key
(use-package which-key
  :config
  (which-key-mode))

(provide 'init-editor)

;;; init-editor.el ends here
